<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use App\Models\Config;

class Subscribe extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($name,$msg,$host)
    {
        $this->name = $name;
        $this->msg = $msg;
        $this->host = $host;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        $config = Config::indexConfig();
        return $this->from(env('MAIL_USERNAME'),$config->title_simple)->subject($config->title_simple."发布了一条新消息！")->view('emails.subscribe')->with([
            'msg' => $this->msg,
            'name' => $this->name,
            'host' => $this->host,
            "config" => $config,
        ]);
    }
}
